home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / iib122.lha / IIB / Threads / sperical_brushmaps < prev    next >
Internet Message Format  |  1998-02-17  |  5KB

  1. Date:         Thu, 23 Oct 1997 19:56:55 GMT
  2. From: Robert Dales <robert.dales@UPN.CO.UK>
  3. Subject:      [IML] Quest: brushmaps for spherical mapping
  4.  
  5. On the Imagine FTP site is a brushmap for a golfball which, rather than just
  6. being a series of spots, has been designed so that when it is wrapped around a
  7. sphere the spots appear in the correct place on the sphere rather than being
  8. distorted (am I making sense?). I remember seeing the method for making such
  9. brushmaps in 'Understanding Imagine' but I'm afraid I sold my copy of that
  10. rather excellent book when I sold my Amiga a couple of years ago (the example
  11. given in the book was of a basketball). Does anyone out there know of any
  12. software or methodology that will take a flat brushmap and transform it into one
  13. suitable for mapping round a sphere without distortion?
  14.  
  15. ----------------------------------
  16.  
  17. Date:         Thu, 23 Oct 1997 15:45:50 -0400
  18. From: Javahead jones <smulders@tc.net>
  19.  
  20.     "Roughly" Make your map twice as wide as high. Not perfect by any means;
  21. but seems to do the trick 'somewhat'.
  22.  
  23.     Hajo
  24.  
  25. ----------------------------------
  26.  
  27. Date:         Thu, 23 Oct 1997 13:01:06 -0700
  28. From: Matt Kropp <cmkropp@HOME.NET>
  29.  
  30. This would be converting 3D polar coordinates to 2D rectangular coordinates.
  31. So if you define your brushmap in X,Y,Z space you can convert it to 2D
  32. rectangular coordinates with
  33.  
  34. U = arctan(Y/X)
  35. V = arctan(Z/R)
  36.  
  37. where U and V are the new X and Y locations on your brushmap and R is the
  38. radius of the sphere you are converting to flat mapping.  You will have to
  39. decide on appropriate scaling for the image since these formulas only return
  40. values between 0.0 and 1.0 (if you are working in radians).
  41.  
  42. Incidentally, Adobe PhotoShop has a function to convert images between
  43. rectangular and polar coordinates which almost makes creating spherical image
  44. maps easy.  No programming required.
  45.  
  46. ----------------------------------
  47.  
  48. Date:         Thu, 23 Oct 1997 18:33:36 +0400
  49. From: Charles Blaquière <blaq@INTERLOG.COM>
  50.  
  51. Steve simply made explicit the math behind spherical mapping, i.e. how
  52. the angle around Z and the one around X are transformed into X,Y
  53. coordinates to be looked up in the brushmap. His legendary basketball
  54. brushmaps were generated by a C program he wrote, that calculated
  55. whether a certain point on the basketball should be a stripe, one of the
  56. tiny raised pips, or just plain rubber. The program generated the
  57. appropriate brushmaps that would reproduce the effect when spherically
  58. mapped.
  59.  
  60. This doesn't help you much in creating brushmaps of your own, unless
  61. you're a programmer. Just remember that a brushmap's horixontal pixels
  62. get mapped to a 360-degree angle around Z, while its vertical dimension
  63. gets wrapped around a 180-degree angle around X. This is why a brushmap
  64. should be twice as wide as tall, since its horizontal dimension gets
  65. wrapped around a full vs. half-circle.
  66.  
  67. In addition, as you get closer to the poles of the spherically-mapped
  68. object, the brushmap's width is wrapped around an ever-smaller circle,
  69. so details that are the same size (in brushmap pixels) appear
  70. ever-smaller (in Imagine units). Here's an example, with a 200x100
  71. brushmap and a 50-radius sphere:
  72.  
  73. +-------------------+   C          _-+-_
  74. |                   |             /     \
  75. |                   |   B        +-------+
  76. |                   |           |         |
  77. |                   |   A       +---------+
  78. |                   |           |         |
  79. |                   |   B        +-------+
  80. |                   |             \_   _/
  81. +-------------------+   C           -+-
  82. <--- 200 pixels ---->
  83.  
  84. At the sphere's equator (A), the brushmap's horizontal line of 200
  85. pixels gets mapped onto a circle 50 units in diameter, i.e.
  86. (2*pi*radius) 314 units long. Each brushmap pixel is about 1.6 Imagine
  87. units wide.
  88.  
  89. Halfway up or down the sphere (B), 200 brushmap pixels are wrapped
  90. around a circle only 35.35 Imagine units in diameter, i.e. (2*pi*radius)
  91. 212 units long. Each brushmap pixel is about 1.06 Imagine units wide.
  92.  
  93. Finally, at the poles (C), all 320 pixels at the top or bottom of the
  94. brushmap are squeezed together into a tiny area. Essentially, an entire
  95. horizontal line of black pixels at the top or bottom of the brushmap
  96. would look as big as a single black pixel in the middle!
  97.  
  98. What all of this teaches you is that, as you move away from the
  99. horizontal centerline of a brushmap, you must paint ever-wider details
  100. if you want them to have a consistent size once mapped into the Imagine
  101. universe. An example is the metal environment brushmap I have placed at
  102. http://www.interlog.com/~blaq/tutorials/BicycleGear/Metal.gif -- notice
  103. how, as you get close to the top and bottom of the image, I faded into
  104. very wide streaks, to ensure blobs as large at the poles as elsewhere.
  105.  
  106. One foolproof way to generate spherical brushmaps is with Steve's Forge
  107. program, only available for the Amiga. One of its many features is the
  108. ability to wrap a set of texture attributes around an imaginary sphere,
  109. and render a brushmap that, when spherically-wrapped, will reproduce
  110. that appearance.
  111.  
  112. ----------------------------------
  113.  
  114.